//
//  ViewController.m
//  11106
//
//  Created by student on 16/2/29.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UIScrollViewDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollview;
@property (weak, nonatomic) IBOutlet UIPageControl *pagecontrol;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.scrollview.contentSize = CGSizeMake(1280, 568);
    UIImageView *imageview1 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"guide0"]];
    imageview1.frame = CGRectMake(0,0, 320, 568);
    UIImageView *imageview2 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"guide1"]];
    imageview2.frame = CGRectMake(320,0, 320, 568);
    UIImageView *imageview3 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"guide2"]];
    imageview3.frame = CGRectMake(640,0, 320, 568);
    UIImageView *imageview4 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"guide3"]];
    imageview4.frame = CGRectMake(960,0, 320, 568);
    
    [self.scrollview addSubview:imageview1];
    [self.scrollview addSubview:imageview2];
    [self.scrollview addSubview:imageview3];
    [self.scrollview addSubview:imageview4];
    self.scrollview.delegate = self;
    self.pagecontrol.numberOfPages = 4;
    self.pagecontrol.currentPage = 0;
    self.scrollview.pagingEnabled = YES;
    self.pagecontrol.pageIndicatorTintColor = [UIColor orangeColor];
    self.pagecontrol.currentPageIndicatorTintColor = [UIColor redColor];
    
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    self.pagecontrol.currentPage = self.scrollview.contentOffset.x/320;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
